// 入库相关API接口
import request from '../request'

export default {
  // 获取入库单列表
  getInboundList(cmd, data) {
    return request.post("/voucher/list", {
      cmd: cmd,
      data: {
        settings: "ax_order_inbound.xml",
        dir: "warehouse.order",
        ...data
      }
    })
  },
  // 获取入库单详情
  getInboundDetail(id) {
    return request.get(`/inbound/${id}`)
  },

  // 创建入库单
  createInbound(data) {
    return request.post('/inbound/create', data)
  },

  // 更新入库单
  updateInbound(id, data) {
    return request.put(`/inbound/${id}`, data)
  },

  // 删除入库单
  deleteInbound(id) {
    return request.delete(`/inbound/${id}`)
  },

  // 确认入库
  confirmInbound(id, data) {
    return request.post(`/inbound/${id}/confirm`, data)
  },

  // 取消入库
  cancelInbound(id, reason) {
    return request.post(`/inbound/${id}/cancel`, { reason })
  },

  // 扫码入库
  scanInbound(code, data) {
    return request.post('/inbound/scan', { code, ...data })
  },

  // 批量入库
  batchInbound(data) {
    return request.post('/inbound/batch', data)
  },

  // 获取入库统计
  getInboundStats(params) {
    return request.get('/inbound/stats', params)
  },

  // 获取入库类型
  getInboundTypes() {
    return request.get('/inbound/types')
  },

  // 获取供应商列表
  getSuppliers(params) {
    return request.get('/inbound/suppliers', params)
  },

  // 获取入库单状态
  getInboundStatus(id) {
    return request.get(`/inbound/${id}/status`)
  },

  // 打印入库单
  printInbound(id) {
    return request.get(`/inbound/${id}/print`)
  },

  // 导出入库数据
  exportInbound(params) {
    return request.get('/inbound/export', params)
  },

  // 获取入库历史
  getInboundHistory(params) {
    return request.get('/inbound/history', params)
  }
} 